com.supermap.data

Class Toolkit

  • java.lang.Object
    • com.supermap.data.Toolkit


  • public class Toolkit
    extends java.lang.Object
    The toolkit class.

    The toolkit class provides some assistant calculating function, such as the overloaded method to determine whether the given value is zero.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static double calcAngle(Point2D p1, Point2D p2, Point2D p3)
      Calculates the clockwise angle between the two lines which are built by three points in order
      static void clearErrors()
      Clears all the error log.
      static boolean compactDatasource(Datasource datasource)
      Compress the specified datasource so that the UDB datasource will occupy much less store space than before.
      boolean extractCacheFile(java.lang.String sourceFileName, java.lang.String targetFolderName)
      Extracts the Cache file to the specified path.
      boolean extractCacheFile(java.lang.String sourceFileName, java.lang.String targetFolderName, java.lang.String password)
      Extracts the Cache file to the specified path.
      static java.lang.String GeometryToGeoJson(Geometry geometry)
      Geometry object to GeoJson
      static ErrorInfo[] getAllErrors()
      Return all error logs
      static EncodeType[] getEncodeType(DatasetType type)
      Returns the array of encode type which the specified dataset type support.
      static boolean isZero(double value)
      Determines whether value is 0, use the tolerance set in Environment.
      static ErrorInfo getLastError2()
      Returns the latest error message of the current thread
      static ErrorInfo[] getLastErrors(int count)
      Return the error log that sets the number of bars forward from the last one
      static boolean isZero(double value, double precision)
      Determines whether the given value is 0, use precision as the determine precision.
      static boolean isZero(double value, double minPrecision, double maxPrecision)
      Determines whether the specified value is zero with the minPrecision and the maxPrecision as the tolerance.
      static boolean unCompress(java.lang.String srcFileName, java.lang.String targetFolder, java.lang.String password)
      Uncompresses the target file.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isZero

        public static boolean isZero(double value)
        Determines whether value is 0, use the tolerance set in Environment. The determine precision defined in the Environment class includes zero determine precision and default value determine precision, here the default determine precision is used, that is the zero determine precision given by the system, see Environment for more information.
        Parameters:
        value - value to test
        Returns:
        True, if the value is zero; Otherwise, returns false.
        See Also:
        Environment
      • isZero

        public static boolean isZero(double value,
                                     double precision)
        Determines whether the given value is 0, use precision as the determine precision.
        Parameters:
        value - value to test
        precision - The precision user gave to determine whether the value is zero.
        Returns:
        a boolean, true means the value is 0.
        See Also:
        Environment
      • isZero

        public static boolean isZero(double value,
                                     double minPrecision,
                                     double maxPrecision)
        Determines whether the specified value is zero with the minPrecision and the maxPrecision as the tolerance.
        Parameters:
        value - value to test
        maxPrecision - The specified maximum precision, which is the upper limit of the determined tolerance.
        minPrecision - The specified minimum precision, which is the lower limit of the determined tolerance.
        Returns:
        a boolean, true means the value is 0.
        See Also:
        Environment
      • compactDatasource

        public static boolean compactDatasource(Datasource datasource)
        Compress the specified datasource so that the UDB datasource will occupy much less store space than before.

        The SMID of compressed geometry object will change. If you set the SMID as the external key for other tables, you should manage it before the compress operation.

        Parameters:
        datasource - The datasource object which need to be compressed. It is only effective on UDB engines, other engines will return false.
        Returns:
        A Boolean value represents whether the Compressing successfully. True, if successful;Otherwise,false.
      • getEncodeType

        public static EncodeType[] getEncodeType(DatasetType type)
        Returns the array of encode type which the specified dataset type support.
        Parameters:
        type - the type of the dataset passed in.
        Returns:
        the array of encode types the dataset supports.
      • clearErrors

        public static void clearErrors()
        Clears all the error log.
      • extractCacheFile

        public boolean extractCacheFile(java.lang.String sourceFileName,
                                        java.lang.String targetFolderName)
        Extracts the Cache file to the specified path.
        Parameters:
        sourceFileName - The path of the cache file to be extracted.
        targetFolderName - the target folder path
        Returns:
        Returns true if successful, otherwise returns false.
      • extractCacheFile

        public boolean extractCacheFile(java.lang.String sourceFileName,
                                        java.lang.String targetFolderName,
                                        java.lang.String password)
        Extracts the Cache file to the specified path.
        Parameters:
        sourceFileName - the source file name
        targetFolderName - the target folder path
        password - The password of the cache data.
        Returns:
        Returns true if successful; otherwise, false.
      • unCompress

        public static boolean unCompress(java.lang.String srcFileName,
                                         java.lang.String targetFolder,
                                         java.lang.String password)
        Uncompresses the target file.
        Parameters:
        srcFileName - The full path of the source file.
        targetFolder - The full path of the target file. The full path is the file name after extracted.
        password - the specified password.
        Returns:
        Returns true if successful; otherwise false.
      • calcAngle

        public static double calcAngle(Point2D p1,
                                       Point2D p2,
                                       Point2D p3)
        Calculates the clockwise angle between the two lines which are built by three points in order
        Parameters:
        p1 - the first point.
        p2 - The second point, the vertex of the angle
        p3 - the third point.
        Returns:
        Returns the angle, the unit is degree
      • GeometryToGeoJson

        public static java.lang.String GeometryToGeoJson(Geometry geometry)
        Geometry object to GeoJson
        Parameters:
        geometry - Geometric objects
        Returns:
        GeoJson
      • getLastError2

        public static ErrorInfo getLastError2()
        Returns the latest error message of the current thread
        Return:
        The latest error message of the current thread
      • getLastErrors

        public static ErrorInfo[] getLastErrors(int count)
        Return the error log that sets the number of bars forward from the last one
        Parameters:
        count - The number of backwards from the last of the log specified.
        Return:
        The error log of the number of bars is formulated from the last one forward.
      • getAllErrors

        public static ErrorInfo[] getAllErrors()
        Return all error logs.
        Return:
        All error logs.